export interface PersonState {
  name: string
  age: number
  sex?: string
  readonly id: number
  [propName: string]: any
}
const o: PersonState = {
  name: '张三',
  age: 18,
  id: 110,
  height: 220,
}
const o1: PersonState = {
  name: '李四',
  age: 20,
  sex: '男',
  id: 120,
  like: '足球',
}
console.log(o, o1)
interface ArrState {
  [propName: number]: number
}
interface ArrState1 {
  [propName: number]: string | number
}
const arr: number[] = [1, 2, 3, 4]
const arr1: ArrState = [1, 2, 3, 4, 4, 5]
const arr3: ArrState1 = ['a', 'b', 'c', 1, 2, 3, 4]
console.log(arr, arr1, arr3)
interface AddState {
  (x: number, y: number): number
}
const add: AddState = (x: number, y: number): number => x + y
console.log(add)
interface PersonClassState {
  name: string
  age: string
  sex: string
  sayName(): void
}
class Father {
  sex!: string
}
class Person extends Father implements PersonClassState {
  name!: string
  age!: string
  constructor() {
    super()
  }
  sayName(): void {
    console.log(123)
  }
}
interface ObjState extends PersonClassState {
  height: number
  weight: number
  like: string
}
const obj: ObjState = {
  height: 1,
  weight: 1,
  like: '123123',
  name: '123',
  age: '123',
  sex: '123',
  sayName() {
    console.group(1231231321)
  },
}
